package com.neuedu.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.neuedu.common.ServerResponse;
import com.neuedu.pojo.Department;
import com.neuedu.service.IDepartmentService;

@RestController
@RequestMapping("/his01/")
public class DepartmentController {
	//依赖注入业务层组件
	@Autowired
	private IDepartmentService departmentService;
	
	//搜索科室的方法(根据科室编号和名称搜索
	@RequestMapping("search.do")
	public ServerResponse<Object> search(String keywords,Integer PageNum,Integer PageSize){
		return departmentService.search(keywords,PageNum,PageSize);
	}
	//添加科室
	//http://localhost:8080/his01/add.do
	@RequestMapping("add.do")
	public ServerResponse<Object> addDepartment(Department department) {
		return departmentService.add(department);
	}
	
	//查询所有科室
	@RequestMapping("query.do")
	public ServerResponse<Object> queryAll(){
		return departmentService.queryAll();
	}
	//更新科室
	@RequestMapping("update.do")
	public ServerResponse<Object> update(Department department) {
		return departmentService.update(department);
	}
	@RequestMapping("delete.do")
	public ServerResponse<Object> delete(Integer ID){
		return departmentService.delete(ID);
	}
}
